//part1:C06:ex6.5.cpp
// integer absolute value.
#include <iostream>
#include <cmath>

double myAbsolute(double val) {
    if (val < 0) {
        return val * -1;
    }
    else {
        return val;
    }
}

double myAbsolute2(double val) {
    return abs(val);
}

int main(void) {
    using namespace std;
    double num;
    cout << "Enter a integer:\n";
    cin >> num;
    cout << num << " absolute value is : " << myAbsolute(num) << endl;
    cout << num << " absolute value is : " << myAbsolute2(num) << endl;

    return 0;
}
